package com.hanlp.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * K线数据Bean
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class KLineData {
    private String name;        // 股票名称
    private String code;        // 股票代码
    private int market;         // 市场标识
    private int decimal;        // 小数位数
    private int dktotal;        // 数据总数
    private List<KLineItem> klines;  // K线数据列表

    public KLineData(String name, String code, int market) {
        this.name = name;
        this.code = code;
        this.market = market;
    }

    /**
     * K线单项数据
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class KLineItem {
        private String date;        // 日期
        private double open;        // 开盘价
        private double close;       // 收盘价
        private double high;        // 最高价
        private double low;         // 最低价
        private long volume;        // 成交量
        private double turnover;    // 成交额
        private double amplitude;   // 振幅
        private double changePercent; // 涨跌幅
        private double changeAmount;  // 涨跌额
        private double turnoverRate;  // 换手率

        public KLineItem(String date, double open, double close, double high, double low, long volume) {
            this.date = date;
            this.open = open;
            this.close = close;
            this.high = high;
            this.low = low;
            this.volume = volume;
        }
    }
}